﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Felbot.Interaction;

namespace Felbot {
    /// <summary>A little form that allows the user to store and use a list of CD-keys.</summary>
    public partial class frmEditViewer : Form {
        frmUserEntryManager m_Manager;
        XmlEntry m_Entry;

        /// <summary>Creates a new flags form.</summary>
        /// <param name="manager">The User Entry Manager that opened it.</param>
        /// <param name="entry">The entry.</param>
        public frmEditViewer(frmUserEntryManager manager, XmlEntry entry) {
            InitializeComponent();
            m_Manager = manager;
            m_Entry = entry;
            LoadEditsList();
        }

        private void LoadEditsList() {
            XmlEntryEdit created = m_Entry.Created;
            ListViewItem item = lvEdits.Items.Add(new ListViewItem(new string[] { created.Time.ToShortDateString() + "  " + created.Time.ToShortTimeString(), created.By + " (created)" }));
            item.ForeColor = Color.Gold;
            foreach (XmlEntryEdit edit in m_Entry.Edits)
                lvEdits.Items.Add(new ListViewItem(new string[] { created.Time.ToShortDateString() + "  " + created.Time.ToShortTimeString(), edit.By }));
        }

        private void btnDone_Click(object sender, EventArgs e) {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
